package com.aramis.mydytt.ui.topic.detail

import androidx.lifecycle.MutableLiveData
import com.aramis.mydytt.ui.base.BaseViewModel
import com.aramis.mydytt.ui.bean.MovieSpecialDetailBean
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * Description: TopicDetailViewModel
 * @author lizhidan
 * Created: 2021/5/24
 */
class TopicDetailViewModel : BaseViewModel() {
    val topicDetailLiveData = MutableLiveData<MovieSpecialDetailBean?>()

    fun getTopicDetail(topicId: Int) {
        compositeDisposable.add(
            movieApi.getSpecialDetail(topicId).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
                .subscribe({
                    topicDetailLiveData.postValue(it.data)
                }, {
                    topicDetailLiveData.postValue(null)
                })
        )
    }
}